import { http } from "@/utils/http";

export type commonResult<T> = {
  code: number;
  msg: string;
  result: T;
};

export type infoType = {
    id?:number,
	userId?: string,
	userName?: string,
    unityId?: number,
    unityName?: string,
    familyId?: string,
    familyName?: string,
    deviceIds?: any,
    // supUnityId?: string,

}
export type infoTypeList = {
  data: infoType[];
  total: number;
};

const List = '/system/device/v2/family/empowers-family';
const Url = '/system/device/v2/family/empower';
export const getList = (params?: object) => {
  return http.request<commonResult<infoTypeList>>("get", List, {
    params
  });
};
export const getInfo = (params?: object) => {
  return http.request<commonResult<infoType>>("get", Url, {
    params
  });
};
export const addInfo = (data?: object) => {
  return http.request<commonResult<any>>("post", Url, {
    data
  });
};
export const editInfo = (data?: object) => {
  return http.request<commonResult<any>>("put", Url, {
    data
  });
};
export const deleteInfo = (data?: object) => {
  return http.request<commonResult<any>>("delete", Url, {
    data
  });
};
/**1.2.15.7根据家庭id查询授权设备 */
export const getdeviceList = (params?: object) => {
  return http.request<commonResult<any>>("get", '/system/device/v2/family/devices', {
    params  });
};
/**1.2.15.5 获取家庭授权监管单位列表(通过家庭获取) */
export const getdeviceempowersList = (params?: object) => {
  return http.request<commonResult<any>>("get", '/system/device/v2/family/empowers-family', {
    params  });
};
/**1.2.8.5 获取所有角色 */
// export const getrole = (params?: object) => {
//   return http.request<commonResult<any>>("get", '/system/system/v2/project/role-list', {
//     params  });
// };